package com.code.point.model.po;

import com.code.common.models.po.BasePO;
import com.code.common.validators.CreateGroup;
import com.code.common.validators.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;

/**
 * 用户积分PO及持久层对象
 *
 * @author tangyifei
 */
@EqualsAndHashCode(callSuper = false)
@ApiModel("用户积分PO及持久层对象")
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Point extends BasePO<Long> {

    private static final long serialVersionUID = -7491215402569546437L;

    @ApiModelProperty(value = "主键 添加时非必填 修改、删除时必填", example = "1")
    @Id
    @GeneratedValue(generator = "JDBC")
    private Long id;

    @ApiModelProperty(value = "用户主键 必填", example = "1")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "user_id is not null")
    private Long userId;

    @ApiModelProperty(value = "积分 必填", example = "1")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "credit is not null")
    private Integer credit;

}
